package com.otherTest.bcrypt;
/*
 * Copyright (c) 2018  菠菜数块链版权所有.
 */

import org.junit.Test;

/**
 * @Description: Bcrypt加解密
 * @author: conceit
 * @Date: 2018/11/12 0012 16:11
 */
public class TestBcrypt {

    @Test
    public void test(){

        //生成的密钥可以通用
        //$2a$10$3.NGBzh9P13LyXtpd52mf.4NnwPGN7CUGpg0S56Qp865aOtIP.gt6
        //$2a$10$pQ.t7iw0AMd3IpHFwCfineB5ZzqPqbv7dMV8wwglPt/EKCl9xoxMG
        //String password=new BcryptPasswordUtils().encode("123465");
        //System.out.println(password);

        boolean isMatch = new BcryptPasswordUtils().matches("123465", "$2a$10$3.NGBzh9P13LyXtpd52mf.4NnwPGN7CUGpg0S56Qp865aOtIP.gt6");
        System.out.println(isMatch);
    }
}
